package com.wtwd.device.service;


import com.wtwd.device.model.entity.SysUser;

import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * @author mjy
 * @date 2021/06/08
 * @description
 */
public interface RedisService {

    //创建token
    void createToken(SysUser sysUser, String token);

    //设置key值
    void setKey(String key, String value, long expireTime, TimeUnit timeUnit);

    void setHash(String key, Map<String, Object> map, long expireTime, TimeUnit timeUnit);

    //获取token里面的用户数据
    Map<String, Object> getUserInfoByToken(String token);

    boolean delKey(String token);

    /**
     * 批量删除hash 值
     *
     * @param key
     * @param hashKeys
     * @return
     */
    void bathDelHashKey(String key, List<String> hashKeys);

    /**
     * 批量删除key
     *
     * @param keys
     * @return
     */
    void bathDelKey(List<String> keys);

    /**
     * 保存缓存
     *
     * @param key
     * @param hashKey
     * @param object
     */
    void saveCache(String key, String hashKey, Object object);

    /**
     * 移除缓存
     *
     * @param key
     * @param hashKey
     */
    void deleteCache(String key, String hashKey);

    /**
     * 获取缓存
     * @param heathTypeKeyPrefix
     * @return
     */
    Map<String, Object> getHashValue(String heathTypeKeyPrefix);
}
